<template>
  <div>
    <input type="text" placeholder="请输入您的愿望吧" v-model="title" />
    <van-button type="default" @click="add" :style="{background:color}">{{active}}</van-button>
  </div>
</template>

<script>
export default {
  components: {},
  props: ["color"],
  data() {
    return {
      title: ""
    };
  },
  methods: {
    // 点击许愿
    add() {
      this.$emit("addxy", this.title);
      // 输入完清空
      this.title = "";
    }
  },
  // 计算属性
  computed: {
    //
    active() {
      if (this.color.length > 0) {
        return "许愿";
      } else {
        return "再想想";
      }
    }
  }
};
</script>


<style lang="scss">
</style>

